import React from 'react'
import { AccountContext } from '../../context'
import { UserIocn } from './Icon'
import { Form, Input as AntdInput, InputProps } from 'antd'
import './index.less'
import { NamePath } from 'antd/lib/form/interface'
import { Rule } from 'antd/lib/form'
export interface AccountInputProps extends Omit<InputProps, 'name'> {
  name?: NamePath
  label?: string
  rules?: Rule[]
}
export const Input = ({ name, label, rules, ...rest }: AccountInputProps) => {
  const { onSubmit } = React.useContext(AccountContext)

  return <Form.Item label={label} name={name} rules={rules} >
    <AntdInput onPressEnter={onSubmit}  {...rest} />
  </Form.Item>
}

